<template>
  <div>
    <h3>小三组件</h3>
    <div>金钱：{{ money1 + 500 }}</div>
    <button @click="buyb(500)">买包-500</button>
    <button @click="doHairAsync(200)">做头发-200</button>
  </div>
</template>

<script>
import { mapActions, mapMutations, mapState } from "vuex";
export default {
  computed: {
    ...mapState({
      money1: "money",
    }),
  },
  methods: {
    /* ...mapMutations(["buyb"]), */
    /* ...mapActions(["doHairAsync"]), */
    buyb(val) {
      this.$store.commit("buyb", val);
    },
    doHairAsync(val) {
      this.$store.dispatch("doHairAsync", val);
    },
  },
};
</script>

<style></style>
